#include <stdio.h>
#include <math.h>

//This function calculates the factorial of an integer
//@param num the number to calculate
//@return result
int factorial(int num){
	int result=1;
	int i;
	for(i=0; i < num; i++){
		result*= i+1;
	}
	return result; 
}
// This function calculates summary of squares of an integer
//@param num the number to calculate.
//@return result.
int sum_squares(int num){
	int result=0;
	double i;
	
	for(i = 0; i < num; i++){
		result +=pow(i+1,2); // result cast to int
	}
	return result;
}
//main function
//get data
void main(){
	/* members declaration */	
	int num;
	int result;
	//check that user entered a valid data.
	//num must be a positive number
	do{	
		//get data from user
		printf("Enter an integer number:\n");
		scanf("%d", &num);
	}
	while (num < 0);
	result = factorial(num);
	printf("The factorial is %d\n", result);
	result = sum_squares(num);
	printf("The summary of squares is %d\n", result);

}